from fastapi import APIRouter, Depends
from datetime import datetime
import time

router = APIRouter(
    prefix='/health',  # 移除/api
    tags=['health'],
)

@router.get('/')
def get_health():
    try:
        return {
            'status': 'healthy',
            'timestamp': datetime.now().isoformat(),
            'uptime': time.time()
        }
    except Exception as e:
        return {
            'status': 'unhealthy',
            'error': str(e),
            'timestamp': datetime.now().isoformat()
        }